import xhr from '@/utils/request'
export const getdepartments = () => {
  return xhr({
    url: '/departments',
    method: 'get',
  })
}
export const getdoctor = (page = 1, pageSize = 10, departmentId, name) => {
  return xhr({
    url: '/doctors',
    method: 'get',
    params: {
      page,
      pageSize,
      departmentId,
      name,
    },
  })
}
export const doctorname = (name) => {
  return xhr({
    url: '/doctors',
    method: 'get',
    params: {
      name,
    },
  })
}
export const deletedoctor = (id) => {
  return xhr({
    url: '/doctors/+' + id,
    method: 'delete',
  })
}
export const getdistricts = () => {
  return xhr({
    url: '/districts',
    method: 'get',
  })
}
export const getjobs = () => {
  return xhr({
    url: '/jobs',
    method: 'get',
  })
}
export const gettags = () => (
  xhr({
    url: '/tags',
    method: 'get',
  })
)
export const updatedoctor = (data) => (
  xhr({
    url: '/doctors',
    method: 'post',
    data,
  })
)
export const xgdoctor = (id, data) => (
  xhr({
    url: '/doctors/' + id,
    method: 'post',
    data,
  })
)
export const departments = (id) => (
  xhr({
    url: '/departments/' + id,
    method: 'delete',
  })
)
export const updepartments = (name) => (
  xhr({
    url: '/departments',
    method: 'post',
    data: {
      id: 0,
      name: name,
      pid: 0,
    },
  })
)
export const uptwodepartment = (id, name) => (
  xhr({
    url: '/departments',
    method: 'post',
    data: {
      id: 0,
      name: name,
      pid: id,
    },
  })
)
export const putpartment = (name, id, pid) => (
  xhr({
    url: '/departments/' + id,
    method: 'put',
    data: {
      name,
      pid,
    },
  })
)
